﻿using System;
using WebService.Nafania.BussinesLayer;
using WebService.Nafania.BussinesLayer.Model.Generator;
using WebService.Nafania.Interface;
using WebService.Nafania.ViewLayer.Model;

namespace WebService.Nafania
{
	public class GeneratorService : IGeneratorService
	{
		private static string PrivateKey = "343776d7-ac9a-4a1f-ae95-4a46f295bfa6";

		private BlockDataView TemplateInstance(string alias, string name, long? version)
		{
			return new BlockDataView(PrivateKey, alias, name, version);
		}

		public LineResult GetVersionObject(string alias, string name, long? version)
		{
			return TemplateInstance(alias, name, version).GetVersionObject();
		}

		public BlockInfo GetBlockData(string alias, string name, long? version, Guid blockId)
		{
			return TemplateInstance(alias, name, version).GetBlockData(blockId);
		}

		public BlockInfo SaveBlockData(string alias, string name, long? version, KeyValuePair[] pairs)
		{
			return TemplateInstance(alias, name, version).SaveBlockData(pairs);
		}
	}
}